<?php
namespace app\model;

class TeachingPlanElement extends BaseModel
{
    protected $name = 'teaching_plan_elements';

    // 自动时间戳
    protected $autoWriteTimestamp = true;

    // 类型转换
    protected $type = [
        'extra_data' => 'json',
        'created_at' => 'integer',
        'updated_at' => 'integer',
        'delete_time' => 'integer'
    ];

    // 元素类型常量
    const TYPE_LECTURE = 'lecture';   // 讲解类型
    const TYPE_QUESTION = 'question'; // 提问类型

    /**
     * 关联教案
     */
    public function teachingPlan()
    {
        return $this->belongsTo(TeachingPlan::class, 'plan_id');
    }
} 